package rs.ac.uns.ftn.informatika.mbs2.e11031.etaksi.pomocno;

import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;

public class Beleznik {

	@AroundInvoke
	public Object zabeleziDogadjaj(InvocationContext ctx) throws Exception {
		try {
			org.apache.log4j.Logger.getRootLogger().trace(
					"Klasa: " + ctx.getTarget().getClass() + ", metoda: "
							+ ctx.getMethod() + " je pokrenuta");
			return ctx.proceed();
		} catch (Exception e) {
			org.apache.log4j.Logger.getRootLogger().trace(
					"Klasa: " + ctx.getTarget().getClass() + ", metoda: "
							+ ctx.getMethod());
			e.printStackTrace();
			throw e;
		} finally {
			org.apache.log4j.Logger.getRootLogger().trace(
					"Klasa: " + ctx.getTarget().getClass() + ", metoda: "
							+ ctx.getMethod() + " je zavrsena");
		}
	}
}
